1. Technical Field
The present invention relates to a system and method for predicting lwarx (Load Word And Reserve Index form) and stwcx (Store Word Conditional) instruction outcome. More particularly, the present invention relates to a system and method for generating a test pattern that deliberately positions lwarx-stwcx pairs in a manner that causes the stwcx instruction to succeed in one scenario and fail in another scenario in order to verify both scenarios.
2. Description of the Related Art
Lwarx and stwcx instructions are instruction pairs that reserve an address (lwarx) and store data to the reserved address (stwcx) when the reservation still exists. A challenge found, however, is that the lwarx-initiated reservation may be lost due to reasons such as a processor (or another processor) executing other instructions before the paired stwcx instruction executes (e.g., lwarx, ldarx, stwcx, stdcx, etc.). As a result, the paired stwcx instruction's result is unpredictable and, therefore, difficult to test.
In addition, the memory used by the stwcx instruction is not predictable and, therefore, unknown. Any subsequent instruction using the unknown memory leaves the instruction's result unknown. As the memory usage continues, a possibility exists that much memory may be left in an unknown state, which does not allow for using a CRC method for checking results.
What is needed, therefore, is a system and method that generates lwarx/stwcx instruction pairs such that the stwcx instruction outcome is predictable.